'''
-*-  coding:  utf-8  -*-
Time    : 14:53
Auther  :罗老师
File    :log_utils.py
'''
import logging
import os


# 实例化一个logger对象


logger = logging.getLogger()

log_file = os.path.abspath(__file__).split("common")[0] + r"\log\logtest.log"
fh = logging.FileHandler(log_file, encoding="utf-8")
sh = logging.StreamHandler()

formatter = logging.Formatter("%(asctime)s::[%(module)s]::[%(levelname)s]: [%(lineno)s]: %(message)s")

fh.setFormatter(formatter)
sh.setFormatter(formatter)

logger.addHandler(fh)
logger.addHandler(sh)
logger.setLevel(logging.DEBUG)




